<template>
  <div class="chat-container">
    <!-- 聊天 -->
    <div class="contAllThree mobilChat">
      <div :class="[{ mobileMode: isActive }]" class="AllOne marginRight flex flex-direction mobil mindBox" :style="{ height: screenHeight + 'px' }">

      </div>
      <div class="flexReturn navMarginTop marginRight flex flex-direction">
        <div class="AllOne " style="border-radius: 20px;">
        <div class="chat-content">
    
          <div class="chat" :style="{ height: screenHeight - 240 + 'px', overflow: 'hidden auto' }">
            <div id="mindmap"></div>

          </div>


      
        </div>
      </div>
      <global-footer />
      </div>
  

    </div>

    <!-- <member-model ref="modalMember" v-if="memberShow"></member-model> -->
  </div>
</template>
  
<script>
import ChatList from './ChatList'
import ChatHistory from './ChatHistory'

import { EventSourcePolyfill } from 'event-source-polyfill'
import { fetchEventSource } from '@microsoft/fetch-event-source'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { mapActions, mapGetters, mapState } from 'vuex'
import { getFileAccessHttpUrl, getAction } from '@/api/manage'
import { sessionNoteList } from '@/api/api'
import { deleteAction } from '@/api/manage'
import MemberModel from './component/MemberModel' //付费跳转弹框
import GlobalFooter from '@/components/page/GlobalFooter'
//   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'ChatModel',
  mixins: [],
  components: {
    ChatList,
    ChatHistory,
    MemberModel,
    GlobalFooter,
  },
  data() {
    return {
      isActive: false,
      screenWidth: '',
      screenHeight: '',
      markdown: `
        # 主题 
        ## 子主题1
        - 观点1
        - 观点2
        ## 子主题2
        - 观点1
        - 观点2
        `
    }
  },
  computed: {
    html() {
      return this.md.render(this.markdown);
    }
  },

  watch: {
    //监听路由地址的改变
    $route: {
      immediate: true,
      handler() {
        console.log('this.newMessage', this.$route.query.param)
      },
    },
  },

  mounted() {
    console.log('userInfo', this.userInfo())
    this.$nextTick(function () {
      this.screenWidth = window.innerWidth
      this.screenHeight = window.innerHeight
    })
    this.initMarkmap();

  },
  beforeDestroy() {
    //清除定时器
    clearInterval(this.timer)
    this.timer = null
  },
  methods: {
    ...mapGetters(['nickname', 'avatar', 'userInfo']),
    initMarkmap() {

    },
  },
}
</script>
  
  <style lang="less" scoped >
.reportList {
  padding: 0px;
  height: auto;
  .list-wrap {
    height: auto;
  }
  .li {
    padding: 12px 0px;
  }
}
.contAllThree{
    .AllOne{
      width: auto;
      border-radius: unset;
    }
  }



.inputSend {
  float: left;
  width: 100%;
  // background: rgb(240, 242, 245);
}

.chat-atn {
  &.pop {
    color: #7a46fc;
    background: transparent;
    border-color: #7a46fc;
  }
  &.middle {
    height: 35px;
    padding: 0 23px;
    line-height: 35px;
    float: left;
    margin-right: 10px;
  }
}

.chat-messages {
  display: flex;
  align-items: center;
  margin: 12px 0 0 0;
  float: left;
  width: 100%;
  .chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    border-radius: 8px;
    height: 60px;
    line-height: 20px;
    padding: 10px 20px;
    background: #f7f7f7;
    margin-right: 10px;
  }
}

.chat-atn {
  border-radius: 4px;
  line-height: 1.5715;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  touch-action: manipulation;
  height: 32px;
  padding: 4px 15px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.25);
  background: #f5f5f5;
  border-color: #d9d9d9;
  text-shadow: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  &.disable {
    cursor: not-allowed;
  }
  &.active {
    background: #7a46fc;
    border-color: #7a46fc;
    color: white;
    cursor: pointer;
  }
  .iconfont {
    margin-right: 5px;
  }
}
.chat-atn:hover {
  opacity: 0.7;
}
.chat {
  height: 450px;
  overflow-y: auto;
  background: url(../../assets/chatlogo1.png) no-repeat center;
  // background-attachment: fixed;
  background-size: 30%;
  float: left;
  width: 100%;
  .classify.right {
    width: 100%;
    text-align: right;
    display: block;
    .chatBox {
      width: 100%;
      display: flex;
      flex-direction: row-reverse;
    }
    .message {
      float: right;
    }
    img {
      margin-left: 10px;
    }
    .message-text {
      text-align: left;
      &.active {
        // background: linear-gradient(to bottom,blue,red);
        animation-name: blink;
        animation-duration: 5s;
      }
      @keyframes blink {
        0% {
          opacity: 1;
          color: red;
        }
        50% {
          opacity: 0.8;
          color: red;
        }
        70% {
          opacity: 0.6;
        }
        100% {
          opacity: 1;
        }
      }
    }
   
  }
  .classify.left {
    .message {
      float: left;
    }
    .message-text {
      &.active {
        // background: linear-gradient(to bottom,blue,red);
        animation-name: blink;
        animation-duration: 5s;
      }
      @keyframes blink {
        0% {
          opacity: 1;
          color: red;
        }
        50% {
          opacity: 0.8;
          color: red;
        }
        70% {
          opacity: 0.6;
        }
        100% {
          opacity: 1;
        }
      }
    }

    img {
      margin-right: 10px;
    }
  }
  .classify.base {
    .message-text {
      background-color: #938bff;
      color: white;
    }
  }
  .classify {
    margin-bottom: 20px;
    float: left;
    width: 100%;
    .chatBox {
      display: flex;
      align-items: center;
      .chat-header {
        float: left;
        img {
          width: 40px;
          height: 40px;
          object-fit: cover;
          border-radius: 50%;
        }
      }
      .messages {
        max-width: 80%;
        float: left;
        .message {
        }
      }
    }
  }
  .message-text {
    background-color: #f7f7f7;
    padding: 10px 20px;
    border-radius: 8px;
    color: #24292f;
    font-size: 15px;
  }
}



.loading {
  width: 22px;
  height: 22px;
  border: 2px solid #1890ff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: rotate 0.75s linear infinite;
  float: right;
  margin-left: 4px;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}



@media screen and (max-width: 767px) {

  .mobilChat{
    .AllOne {
      padding: 0;
    }
  }

}



.mindBox{
  width: 330px!important;
}

#mindmap {
    height: 500px;
    width: 100%;
}
</style>
  